package com.inter.law;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;

import org.apache.derby.client.am.DateTime;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.inter.law.dao.IlTaskDAO;
import com.inter.law.entity.IlTask;
import com.opensymphony.xwork2.ActionSupport;

public class Createtask extends ActionSupport{
	private String content;
	private Timestamp startDate;
	private String taskProfile;
	private Timestamp endDate;
	private Boolean isWholeDay;
	private ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
	public String execute() throws Exception{
			System.out.println("the value of taskProfile    :"+taskProfile);
			IlTaskDAO ilTaskDAO = IlTaskDAO.getFromApplicationContext(ac);
			IlTask ilTask = new IlTask();
			ilTask.setTaskProfile(taskProfile);
			ilTask.setContent(content);
			ilTask.setEndDate(endDate);
			ilTask.setStatus(0);
			ilTask.setIsWholeDay(isWholeDay);
			//ilTask.setStartDate(new Date(Calendar.getInstance().getTime().getTime()));
			ilTask.setStartDate((Timestamp) new Timestamp(Calendar.getInstance().getTime().getTime()));
			ilTaskDAO.save(ilTask);
			System.out.println("任务创建成功");
			return SUCCESS;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public Timestamp getStartDate() {
		return startDate;
	}
	public void setStartDate(Timestamp startDate) {
		this.startDate = startDate;
	}
	public String getTaskProfile() {
		return taskProfile;
	}
	public void setTaskProfile(String taskProfile) {
		this.taskProfile = taskProfile;
	}
	public Timestamp getEndDate() {
		return endDate;
	}
	public void setEndDate(Timestamp endDate) {
		this.endDate = endDate;
	}
	public Boolean getIsWholeDay() {
		return isWholeDay;
	}
	public void setIsWholeDay(Boolean isWholeDay) {
		this.isWholeDay = isWholeDay;
	}


	
}
